<template>
	<div>
		<template>
			<!-- 搜索条件 -->
			<div class="params">
				<el-form
					ref="ruleForm"
					:model="queryData"
					:rules="rules"
					:inline="true"
				>
					<div>
						<el-form-item
							v-if="languages.includes('zh_CN')"
							:label="
								`${$t('friendInvitation.tasks_title')}-${$t(
									'common.zh'
								)}:`
							"
							prop="inviteTitleZh"
						>
							<el-input
								v-model="queryData.inviteTitleZh"
								size="mini"
								:disabled="!editVisibleChlLid"
								:placeholder="this.$t('common.please_enter')"
								clearable
								style="width: 180px"
								maxlength="500"
							></el-input>
						</el-form-item>
						<el-form-item
							v-if="languages.includes('en_US')"
							:label="
								`${$t('friendInvitation.tasks_title')}-${$t(
									'common.en'
								)}:`
							"
							prop="inviteTitleEn"
						>
							<el-input
								v-model="queryData.inviteTitleEn"
								size="mini"
								:disabled="!editVisibleChlLid"
								:placeholder="this.$t('common.please_enter')"
								clearable
								style="width: 180px"
								maxlength="500"
							></el-input>
						</el-form-item>
						<el-form-item
							v-if="languages.includes('th_TH')"
							:label="
								`${$t('friendInvitation.tasks_title')}-${$t(
									'common.th'
								)}:`
							"
							prop="inviteTitleTh"
						>
							<el-input
								v-model="queryData.inviteTitleTh"
								size="mini"
								:disabled="!editVisibleChlLid"
								:placeholder="this.$t('common.please_enter')"
								clearable
								style="width: 180px"
								maxlength="500"
							></el-input>
						</el-form-item>
						<el-form-item
							v-if="languages.includes('vi_VN')"
							:label="
								`${$t('friendInvitation.tasks_title')}-${$t(
									'common.vn'
								)}:`
							"
							prop="inviteTitleVi"
						>
							<el-input
								v-model="queryData.inviteTitleVi"
								size="mini"
								:disabled="!editVisibleChlLid"
								:placeholder="this.$t('common.please_enter')"
								clearable
								style="width: 180px"
								maxlength="500"
							></el-input>
						</el-form-item>
					</div>
					<div>
						<el-form-item
							:label="`${$t('friendInvitation.tasks_type')}:`"
							prop="inviteRewardType"
						>
							<el-select
								v-model="queryData.inviteRewardType"
								size="mini"
								:placeholder="$t('common.please_choose')"
								:disabled="!editVisibleChlLid"
								style="width: 175px"
								@change="changeTask"
							>
								<el-option
									v-for="item in activeObj"
									:key="item.id"
									:label="item.label"
									:value="item.id"
								></el-option>
							</el-select>
						</el-form-item>
						<!-- <el-form-item
							:label="`${$t('friendInvitation.diposit_type')}:`"
							prop="inviteDepositCountType"
						>
							<el-select
								v-model="queryData.inviteDepositCountType"
								size="mini"
								:placeholder="$t('common.please_choose')"
								:disabled="!editVisibleChlLid"
								style="width: 175px"
							>
								<el-option
									v-for="item in inviteDepositCountTypeObj"
									:key="item.id"
									:label="item.label"
									:value="item.id"
								></el-option>
							</el-select>
						</el-form-item> -->
						<!-- <el-form-item
							v-if="queryData.inviteDepositCountType === 2"
							label-width="120px"
							label="累计存款周期:"
							prop="inviteDepositCountDay"
						>
							<el-input
								v-model="queryData.inviteDepositCountDay"
								size="mini"
								placeholder="请输入"
								clearable
								:disabled="!editVisibleChlLid"
								style="width: 175px"
								maxlength="11"
							>
								<span slot="append">天</span>
							</el-input>
						</el-form-item> -->
						<el-form-item
							:label="
								`${$t('friendInvitation.dividend_method')}:`
							"
							prop="inviteRewardCountType"
						>
							<el-select
								v-model="queryData.inviteRewardCountType"
								size="mini"
								:placeholder="$t('common.please_choose')"
								:disabled="
									!editVisibleChlLid ||
										queryData.inviteRewardType === 2
								"
								collapse-tags
								style="width: 180px"
								@change="checkV"
							>
								<el-option
									v-for="item in inviteRewardCountTypeObj"
									:key="item.id"
									:label="item.label"
									:value="item.id"
								></el-option>
							</el-select>
						</el-form-item>
						<!-- <el-form-item
							v-if="queryData.inviteRewardCountType === 2"
							:label="`${$t('friendInvitation.maximum_lottery_limit')}:`"
							prop="inviteRewardAmountMax"
						>
							<el-input
								v-model="queryData.inviteRewardAmountMax"
								size="mini"
								:disabled="!editVisibleChlLid"
								:placeholder="$t('common.please_enter')"
								clearable
								style="width: 180px"
								maxlength="500"
							>
								<span v-if="merchantInfoObj.currencySymbol" slot="append">
									{{ merchantInfoObj.currencySymbol }}
								</span>
							</el-input>
						</el-form-item> -->
						<!-- <el-form-item
							:label="`${$t('friendInvitation.dividend_distribution_method')}:`"
							prop="inviteRewardSendType"
						>
							<el-select
								v-model="queryData.inviteRewardSendType"
								size="mini"
								:placeholder="$t('common.please_choose')"
								:disabled="!editVisibleChlLid"
								collapse-tags
								style="width: 175px"
							>
								<el-option
									v-for="item in inviteRewardSendTypeObj"
									:key="item.id"
									:label="item.label"
									:value="item.id"
								></el-option>
							</el-select>
						</el-form-item> -->
						<!-- <el-form-item
							:label="`${$t('friendInvitation.dividend_review')}:`"
							prop="inviteRewardAuditFlag"
						>
							<el-select
								v-model="queryData.inviteRewardAuditFlag"
								size="mini"
								:placeholder="$t('common.please_choose')"
								:disabled="!editVisibleChlLid"
								collapse-tags
								style="width: 175px"
							>
								<el-option :label="$t('common.yes')" :value="1"></el-option>
								<el-option :label="$t('common.no')" :value="0"></el-option>
							</el-select>
						</el-form-item> -->
						<el-form-item
							:label="
								`${$t(
									'funds.proxy_member_funds_record.send_position'
								)}:`
							"
							prop="inviteRewardSendPosition"
						>
							<el-select
								v-model="queryData.inviteRewardSendPosition"
								size="mini"
								:placeholder="$t('common.please_choose')"
								:disabled="!editVisibleChlLid"
								collapse-tags
								style="width: 175px"
							>
								<el-option
									v-for="item in inviteRewardSendPositionObj"
									:key="item.id"
									:label="item.label"
									:value="item.id"
								></el-option>
							</el-select>
						</el-form-item>
						<!-- <el-form-item
							v-if="queryData.inviteRewardSendPosition === 2"
							:label="`${$t('friendInvitation.claim_conditions')}:`"
							prop="inviteRewardReceiveType"
						>
							<el-select
								v-model="queryData.inviteRewardReceiveType"
								size="mini"
								:disabled="!editVisibleChlLid"
								:placeholder="$t('common.please_choose')"
								style="width: 175px"
							>
								<el-option
									v-for="item in inviteRewardReceiveTypeObj"
									:key="item.id"
									:label="item.label"
									:value="item.id"
								></el-option>
							</el-select>
						</el-form-item> -->
					</div>
					<div>
						<el-form-item
							:label="
								`${$t(
									'friendInvitation.Whether_to_receive_rewards'
								)}:`
							"
							prop="inviteRewardInviteesFlag"
						>
							<template>
								<el-radio
									v-model="queryData.inviteRewardInviteesFlag"
									:disabled="!editVisibleChlLid"
									:label="1"
									@change="checkTableFn"
								>
									{{ $t('common.yes') }}
								</el-radio>
								<el-radio
									v-model="queryData.inviteRewardInviteesFlag"
									:disabled="!editVisibleChlLid"
									:label="0"
									@change="checkTableFn"
								>
									{{ $t('common.no') }}
								</el-radio>
							</template>
						</el-form-item>
					</div>
				</el-form>
			</div>
			<!-- table表格 -->
			<!-- 添加按钮 -->
			<div style="margin-top:10px">
				<div class="btn-add" @click="handleAdd">
					<span>{{ $t('operation.activity_list.add1') }}</span>
				</div>
			</div>
			<el-form
				v-if="queryData1.tableForm.inviteTaskRuleList"
				ref="tableForm"
				class="tabs-content-table"
				:model="queryData1.tableForm"
			>
				<el-table
					v-loading="loading"
					element-loading-spinner="el-icon-loading"
					border
					size="mini"
					class="small-size-table"
					:data="queryData1.tableForm.inviteTaskRuleList"
					style="width: 100%"
					:header-cell-style="getRowClass"
					:span-method="arraySpanMethod"
					:row-style="{ height: '30px' }"
					:cell-style="{ padding: '0px' }"
				>
					<el-table-column
						type="index"
						align="center"
						:label="$t('common.serial_number')"
						:width="getWidth(50, 1.3)"
					></el-table-column>
					<el-table-column
						align="center"
						:label="
							`${$t('friendInvitation.deposit_amount')} (${
								merchantInfoObj.currencySymbol
							})`
						"
						prop="depositAmount"
					>
						<template slot-scope="scope">
							<el-form-item
								class="form-item"
								:prop="
									`inviteTaskRuleList.${
										scope.$index
									}.depositAmount`
								"
								:rules="[
									{
										required: true,
										validator: getVaLiDate(
											'depositAmount',
											$t(
												'friendInvitation.deposit_amount'
											),
											scope.$index,
											'inviteTaskRuleList'
										),
										trigger: ['change', 'blur']
									}
								]"
							>
								<el-input
									v-model.trim="scope.row.depositAmount"
									size="mini"
									label=""
									:maxlength="9"
									:disabled="!editVisibleChlLid"
									:controls="false"
								></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<!-- <el-table-column
						v-if="queryData.inviteDepositCountType === 2"
						align="center"
						:label="`${'好友累计存款金额' + merchantInfoObj.currencySymbol}`"
						prop="depositAmount"
					>
						<template slot-scope="scope">
							<el-form-item
								class="form-item"
								:prop="`inviteTaskRuleList.${scope.$index}.depositAmount`"
								:rules="[
									{
										required: true,
										validator: getVaLiDate(
											'depositAmount',
											'好友累计存款金额',
											scope.$index,
											'inviteTaskRuleList'
										),
										trigger: ['change', 'blur']
									}
								]"
							>
								<el-input
									v-model.trim="scope.row.depositAmount"
									size="mini"
									label=""
									:disabled="!editVisibleChlLid"
									:maxlength="9"
									:controls="false"
								></el-input>
							</el-form-item>
						</template>
					</el-table-column> -->

					<el-table-column
						v-if="queryData.inviteRewardType === 2"
						align="center"
						:label="
							`${$t('friendInvitation.number_personnel')}(>=)`
						"
						prop="inviteNum"
					>
						<template slot-scope="scope">
							<el-form-item
								class="form-item"
								:prop="
									`inviteTaskRuleList.${
										scope.$index
									}.inviteNum`
								"
								:rules="[
									{
										required: true,
										validator: getVaLiDate12(
											'inviteNum',
											$t(
												'friendInvitation.number_personnel'
											),
											scope.$index,
											'inviteTaskRuleList'
										),
										trigger: ['change', 'blur']
									}
								]"
							>
								<el-input
									v-model.trim="scope.row.inviteNum"
									size="mini"
									label=""
									:disabled="!editVisibleChlLid"
									:maxlength="9"
									:controls="false"
								></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column
						align="center"
						:label="
							`${$t('friendInvitation.invite_reward_amount')} (${
								queryData.inviteRewardCountType === 2
									? '%'
									: merchantInfoObj.currencySymbol
							})`
						"
						prop="inviteRewardAmount"
					>
						<template slot-scope="scope">
							<el-form-item
								:prop="
									`inviteTaskRuleList.${
										scope.$index
									}.inviteRewardAmount`
								"
								:rules="[
									{
										required: true,
										validator: getVaLiDate(
											'inviteRewardAmount',
											$t(
												'friendInvitation.invite_reward_amount'
											),
											scope.$index,
											'inviteTaskRuleList'
										),
										trigger: ['change', 'blur']
									}
								]"
							>
								<el-input
									v-model.trim="scope.row.inviteRewardAmount"
									size="mini"
									label=""
									:disabled="!editVisibleChlLid"
									:maxlength="9"
									:controls="false"
								></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column
						v-if="queryData.inviteRewardInviteesFlag === 1"
						align="center"
						:label="
							`${$t('friendInvitation.invitee_gift_money')} (${
								queryData.inviteRewardCountType === 1
									? merchantInfoObj.currencySymbol
									: '%'
							})`
						"
						prop="inviteesRewardAmount"
					>
						<template slot-scope="scope">
							<el-form-item
								:prop="
									`inviteTaskRuleList.${
										scope.$index
									}.inviteesRewardAmount`
								"
								:rules="[
									{
										required: true,
										validator: getVaLiDate(
											'inviteesRewardAmount',
											$t(
												'friendInvitation.invitee_gift_money'
											),
											scope.$index,
											'inviteTaskRuleList'
										),
										trigger: ['change', 'blur']
									}
								]"
							>
								<el-input
									v-model.trim="
										scope.row.inviteesRewardAmount
									"
									size="mini"
									label=""
									:maxlength="9"
									:disabled="!editVisibleChlLid"
									:controls="false"
								></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column
						align="center"
						:label="$t('operation.activity_list.flow_need')"
						prop="validMultiple"
					>
						<template slot-scope="scope">
							<div>
								<el-form-item
									:prop="
										`inviteTaskRuleList.${
											scope.$index
										}.validMultiple`
									"
									:rules="[
										{
											required: true,
											validator: getVaLiDate12(
												'validMultiple',
												$t(
													'operation.activity_list.flow_need'
												),
												scope.$index,
												'inviteTaskRuleList'
											),
											trigger: ['change', 'blur']
										}
									]"
								>
									<el-input
										v-model.trim="scope.row.validMultiple"
										size="mini"
										label=""
										:disabled="!editVisibleChlLid"
										:controls="false"
										:maxlength="9"
									></el-input>
								</el-form-item>
							</div>
						</template>
					</el-table-column>

					<el-table-column
						prop="operating"
						align="center"
						:label="$t('common.actions')"
					>
						<template slot-scope="scope">
							<el-button
								type="danger"
								icon="el-icon-delete"
								size="medium"
								:disabled="
									!editVisibleChlLid || scope.$index === 0
								"
								@click="handleDelete(scope.$index)"
							>
								{{ $t('common.delete') }}
							</el-button>
							<div style="height:18px"></div>
						</template>
					</el-table-column>
				</el-table>
			</el-form>
			<!-- 任务形式：按邀请人配送 -->
		</template>
	</div>
</template>

<script>
import list from '@/mixins/list'

export default {
	mixins: [list],
	props: {
		editVisible: {
			type: Boolean,
			default: () => false
		},
		merchantInfoObj: {
			type: Object,
			default: () => {}
		}
	},
	data() {
		return {
			editVisibleChlLid: false,
			activeObj: [
				{ label: this.$t('friendInvitation.by_deposit_amount'), id: 1 },
				{
					label: this.$t('friendInvitation.by_number_of_invitations'),
					id: 2
				}
			],
			languages: [],
			inviteRewardReceiveTypeObj: [
				{ label: '无条件', id: 1 }
				// { label: '绑定手机和银行卡', id: 2 }
			],
			inviteRewardCountTypeObj: [
				{ label: this.$t('operation.activity_list.fix_money'), id: 1 },
				{ label: this.$t('operation.activity_list.rate_money'), id: 2 }
			],
			inviteRewardSendTypeObj: [{ label: '系统发放', id: 1 }],
			inviteDepositCountTypeObj: [
				{ label: '首存存款达标', id: 1 }
				// { label: '累计存款达标', id: 2 }
			],
			inviteRewardSendPositionObj: [
				{
					label: this.$t('funds.capital_adjustment.wallet_center'),
					id: 1
				},
				{ label: this.$t('friendInvitation.dividend_center'), id: 2 }
			],
			queryData: {
				inviteTitleZh: '',
				inviteTitleEn: '',
				inviteTitleTh: '',
				inviteTitleVi: '',
				inviteRewardType: undefined,
				inviteDepositCountDay: '',
				inviteRewardReceiveType: undefined,
				inviteRewardSendType: undefined,
				inviteRewardSendPosition: undefined,
				inviteRewardAuditFlag: undefined,
				inviteRewardAmountMax: '',
				inviteRewardCountType: undefined,
				inviteDepositCountType: undefined,
				inviteRewardInviteesFlag: 0
			},
			queryData1: {
				// 表格
				tableForm: {
					inviteTaskRuleList: [
						{
							depositAmount: undefined,
							inviteNum: undefined,
							inviteRewardAmount: undefined,
							inviteesRewardAmount: undefined,
							validMultiple: undefined
						}
					]
				}
			}
		}
	},
	computed: {
		rules() {
			return {
				inviteTitleZh: [
					{
						required: true,
						message: this.$t('common.please_enter'),
						trigger: 'blur'
					}
				],
				inviteTitleEn: [
					{
						required: true,
						message: this.$t('common.please_enter'),
						trigger: 'blur'
					}
				],
				inviteTitleTh: [
					{
						required: true,
						message: this.$t('common.please_enter'),
						trigger: 'blur'
					}
				],
				inviteTitleVi: [
					{
						required: true,
						message: this.$t('common.please_enter'),
						trigger: 'blur'
					}
				],
				inviteRewardType: [
					{
						required: true,
						message: this.$t('common.please_enter'),
						trigger: 'blur'
					}
				],
				activeTitle: [
					{
						required: true,
						message: this.$t('common.please_enter'),
						trigger: 'blur'
					}
				],
				inviteRewardReceiveType: [
					{
						required: true,
						message: this.$t('common.please_enter'),
						trigger: 'blur'
					}
				],
				inviteRewardCountType: [
					{
						required: true,
						message: this.$t('common.please_enter'),
						trigger: 'blur'
					}
				],
				inviteDepositCountType: [
					{
						required: true,
						message: this.$t('common.please_choose'),
						trigger: 'blur'
					}
				],
				inviteRewardSendType: [
					{
						required: true,
						message: this.$t('common.please_choose'),
						trigger: 'blur'
					}
				],
				inviteRewardAmountMax: [
					{
						required: true,
						message: this.$t('common.please_enter'),
						trigger: 'blur'
					}
				],
				inviteRewardSendPosition: [
					{
						required: true,
						message: this.$t('common.please_choose'),
						trigger: 'blur'
					}
				],
				inviteRewardAuditFlag: [
					{
						required: true,
						message: this.$t('common.please_choose'),
						trigger: 'blur'
					}
				],
				inviteDepositCountDay: [
					{
						required: true,
						message: this.$t('common.please_choose'),
						trigger: 'blur'
					}
				],
				inviteRewardInviteesFlag: [
					{
						required: true,
						message: this.$t('common.please_enter'),
						trigger: 'blur'
					}
				]
			}
		}
	},
	watch: {
		'queryData.inviteRewardType': {
			handler(newV) {
				this.queryData1.tableForm.inviteTaskRuleList = []
				this.queryData1.tableForm.inviteTaskRuleList = [
					{
						depositAmount: undefined,
						inviteNum: undefined,
						inviteRewardAmount: undefined,
						inviteesRewardAmount: undefined,
						validMultiple: undefined
					}
				]
			}
		},
		'queryData.inviteRewardInviteesFlag': {
			handler(newV) {
				this.queryData1.tableForm.inviteTaskRuleList = []
				this.queryData1.tableForm.inviteTaskRuleList = [
					{
						depositAmount: undefined,
						inviteNum: undefined,
						inviteRewardAmount: undefined,
						inviteesRewardAmount: undefined,
						validMultiple: undefined
					}
				]
			}
		},
		merchantInfoObj: {
			handler(newV, oldV) {
				this.languages = newV?.languages?.split(',') || []
			},
			immediate: true
		},
		// 规则配置的圆点检测
		queryData: {
			handler(el) {
				this.$nextTick(() => {
					this.$emit('invite')
				})
				// Object.keys(el).forEach((item) => {
				// 	this.$nextTick(() => {
				// 		this.$emit('invite')
				// 	})
				// })
			},
			deep: true,
			immediate: true
		},
		// 规则配置的圆点检测
		'queryData1.tableForm.inviteTaskRuleList': {
			handler() {
				this.$nextTick(() => {
					this.$emit('invite')
				})
			},
			deep: true,
			immediate: true
		},
		editVisible: {
			handler(val) {
				this.$nextTick(() => {
					this.editVisibleChlLid = val
				})
			},
			deep: true,
			immediate: true
		}
	},

	methods: {
		checkV() {
			this.$nextTick(() => {
				setTimeout(() => {
					this.validate()
					this.$emit('invite')
				}, 500)
			})
		},
		checkTableFn(val) {
			if (val === 1) {
				this.queryData1 = {
					// 表格
					tableForm: {
						inviteTaskRuleList: [
							{
								depositAmount: undefined,
								inviteNum: undefined,
								inviteRewardAmount: undefined,
								inviteesRewardAmount: undefined,
								validMultiple: undefined
							}
						]
					}
				}
			} else if (val === 2) {
				this.queryData1 = {
					// 表格
					tableForm: {
						inviteTaskRuleList: [
							{
								depositAmount: undefined,
								inviteNum: undefined,
								inviteRewardAmount: undefined,
								validMultiple: undefined
							}
						]
					}
				}
			}
		},
		changeTask(val) {
			if (val && val === 2) {
				this.queryData.inviteRewardCountType = 1
			}
			this.checkV()
		},
		getSpan(list) {
			const newArr = []
			const obj = {}
			if (list?.length > 1) {
				for (let i = 0; i < list?.length; i++) {
					if (i === 0) {
						obj.row = 1
						obj.col = 1
						newArr.push(obj)
					} else {
						if (list[i].id === list[i - 1].id) {
							newArr.push({ row: 0, col: 0 })
							const index = list.findIndex((item, index1) => {
								return item.id === list[i - 1].id
							})
							newArr[index].row++
						} else {
							newArr.push({ row: 1, col: 1 })
						}
					}
				}
			}
			return newArr
		},

		arraySpanMethod({ column, rowIndex, columnIndex }) {
			if (this.queryData1.tableForm.inviteTaskRuleList?.length <= 1) { return }
			// const arr = this.getSpan(this.queryData1.tableForm.inviteTaskRuleList)
			// const row = arr[rowIndex].row
			// const col = arr[rowIndex].col
			// if (
			// 	this.queryData.inviteRewardType === 2 &&
			// 	column.label === this.$t('friendInvitation.deposit_amount')
			// ) {
			// 	return {
			// 		rowspan: row,
			// 		colspan: col
			// 	}
			// }
			if (
				(columnIndex === 1 && this.queryData.inviteRewardType === 2) ||
				column.label === this.$t('operation.activity_list.flow_need')
			) {
				if (rowIndex === 0) {
					return {
						rowspan: this.queryData1.tableForm.inviteTaskRuleList
							.length,
						colspan: 1
					}
				} else {
					return {
						rowspan: 0,
						colspan: 0
					}
				}
			}
			// if (column.label === this.$t('operation.activity_list.flow_need')) {
			// 	return {
			// 		rowspan: row,
			// 		colspan: col
			// 	}
			// }
			// if (
			// 	this.queryData.inviteRewardType === 2 ||
			// 	(column.label === this.$t('friendInvitation.invitee_gift_money') &&
			// 		this.queryData.inviteRewardType === 2) ||
			// 	(column.label === this.$t('friendInvitation.deposit_amount') &&
			// 		this.queryData.inviteRewardType === 2)
			// ) {
			// 	return {
			// 		rowspan: row,
			// 		colspan: col
			// 	}
			// }
		},

		// 随时校验
		validate() {
			this.$refs['tableForm'].validate((valid) => {
				if (valid) {
					return valid
				}
			})
		},
		// 删除单行
		handleDelete(index) {
			if (this.queryData1.tableForm.inviteTaskRuleList?.length > 1) {
				this.queryData1.tableForm.inviteTaskRuleList.splice(index, 1)
			} else {
				return this.$message({
					message: this.$t('operation.activity_list.need'),
					type: 'warning'
				})
			}
		},
		// 添加
		handleAdd() {
			if (!this.editVisibleChlLid) return
			const template = {
				depositAmount: undefined,
				inviteNum: undefined,
				inviteRewardAmount: undefined,
				// inviteesRewardAmount: undefined,
				validMultiple: undefined
			}
			this.queryData1.tableForm.inviteTaskRuleList.push(template)

			this.$nextTick(() => {
				setTimeout(() => {
					this.validate()
					this.$emit('invite')
				}, 500)
			})
		},
		getVaLiDate(field, fieldName, index, typeName, submit = false) {
			return (rule, value, callback) => {
				const reg = /^(([0-9]+)|([0-9]+\.[0-9]{0,2}))$/
				this.$nextTick(() => {
					if (!value) {
						callback(
							new Error(
								`${this.$t('common.please_enter') + fieldName}!`
							)
						)
						this.isTableErr = true
					} else if (!reg.test(value) && value) {
						callback(
							new Error(this.$t('operation.activity_list.dot'))
						)
						this.isTableErr = true
					} else if (value && +value === 0) {
						// setTimeout(() => {
						callback(
							new Error(
								this.$t('operation.activity_list.no_zero')
							)
						)
						// }, 1500)
					} else {
						callback()
					}
				})
			}
		},
		getVaLiDate12(field, fieldName, index, typeName, submit = false) {
			return (rule, value, callback) => {
				const reg = /^(([0-9]+))$/
				this.$nextTick(() => {
					if (!value) {
						callback(
							new Error(
								`${this.$t('common.please_enter') + fieldName}!`
							)
						)
						this.isTableErr = true
					} else if (!reg.test(value) && value) {
						callback(
							new Error(
								this.$t('operation.activity_list.integer')
							)
						)
						this.isTableErr = true
					} else if (value && +value === 0) {
						// setTimeout(() => {
						callback(
							new Error(
								this.$t('operation.activity_list.no_zero')
							)
						)
						// }, 1500)
					} else {
						callback()
					}
				})
			}
		},

		// 删除table cell
		deleteRow() {}
	}
}
</script>

<style lang="scss" scoped>
.btn-add {
	width: 60px;
	height: 25px;
	line-height: 25px;
	span {
		display: flex;
		justify-content: center;
		background: #00a7f0;
		align-items: center;
		color: #ffff;
		font-size: 14px;
		cursor: pointer;
	}
}
.form-item ::v-deep .el-form-item__content {
	// height: 30px;
	// line-height: 30px;
}
::v-deep .el-table__row .el-form-item {
	// margin-bottom: 15px;
}
//input-number 位置
::v-deep .el-form-item__content .el-input-group {
	vertical-align: baseline;
}
</style>
